class Solution
{
public:
    bool checkDynasty(vector<int>& places)
    {
        int unknown = 0;
        sort(places.begin(), places.end());
        for (int i = 0; i < 4; i++)
        {
            if (places[i] == 0)  unknown++;
            else if (places[i] == places[i + 1])  return false;
        }
        return places[4] - places[unknown] < 5;
    }
};